package com.lqd.mall.basis.exception;

import com.lqd.mall.basis.code.CustomCode;
import com.lqd.mall.basis.code.ResultCode;
import com.lqd.mall.basis.constant.ResultMessageConstant;

/**
 * @author 零起点
 * @create 2022-01-12
 */
public class ExceptionCast {

    public static void cast(ResultCode resultCode) {
        throw new CustomException(resultCode);
    }

    public static void cast(String message) {
        throw new CustomException(new CustomCode(false, ResultMessageConstant.FAILURE_CODE, message));
    }

    public static void cast(int code) {
        throw new CustomException(new CustomCode(false, code, ResultMessageConstant.FAILURE_MESSAGE));
    }


    public static void cast(int code, String message) {
        throw new CustomException(new CustomCode(false, code, message));
    }

    public static void cast(boolean success, int code, String message) {
        throw new CustomException(new CustomCode(success, code, message));
    }


}
